<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
</head>
<style>
    /* 底部固定区域 */
    .layui-layout-admin .layui-footer {
        padding: 10px 0;
        text-align: center;
    }

    .layui-layout-admin .layui-footer {
        background-color: #fff;
    }


</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form" lay-filter="component-form-element">
                <input type="hidden" name="tid" id="tid">
                <div class="layui-tab-content" style="height: auto">

                    <div class="layui-row">
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设备名称</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="name" id="name" lay-verify="name"
                                               autocomplete="off" placeholder="请输入设备名称"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设施所在自然村</label>
                                    <div class="layui-input-block">
                                        <%--                                        <select type="text" name="cun" id="cun" lay-verify="cun" lay-search>--%>
                                        <%--                                            <option value="">请选择</option>--%>
                                        <%--                                        </select>--%>
                                        <input id="cun" class="layui-input" name="cun" type="text" lay-verify="cun" autoComplete="off"  >
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设施编码</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="ssbm" id="ssbm" lay-verify="ssbm"
                                               autocomplete="off" placeholder="请输入设施编码"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">所属项目</label>
                                    <div class="layui-input-block">
                                        <select  name="proId" id="proId" lay-verify="proId" lay-search>
                                            <option value="">请选择</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>


                    <div class="layui-row">
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">经度</label>
                                    <%--                                    <div class="layui-input-block">--%>
                                    <%--                                        <input type="text" name="jingdu" id="jingdu" lay-verify="jingdu"--%>
                                    <%--                                               autocomplete="off" placeholder="请输入经度"--%>
                                    <%--                                               class="layui-input">--%>
                                    <%--                                    </div>--%>
                                    <div class="layui-input-inline" style="width: 50px;">
                                        <input type="text" name="jdu" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid">度</div>
                                    <div class="layui-input-inline" style="width: 50px;">
                                        <input type="text" name="jfen" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid">分</div>
                                    <div class="layui-input-inline" style="width: 50px;">
                                        <input type="text" name="jmiao" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid">秒</div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">纬度</label>
                                    <div class="layui-input-block">
                                        <%--                                        <input type="text" name="weidu" id="weidu" lay-verify="weidu"--%>
                                        <%--                                               autocomplete="off" placeholder="请输入纬度"--%>
                                        <%--                                               class="layui-input">--%>
                                        <%--                                    </div>--%>
                                        <div class="layui-input-inline" style="width: 50px;">
                                            <input type="text" name="wdu" placeholder="" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid">度</div>
                                        <div class="layui-input-inline" style="width: 50px;">
                                            <input type="text" name="wfen" placeholder="" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid">分</div>
                                        <div class="layui-input-inline" style="width: 50px;">
                                            <input type="text" name="wmiao" placeholder="" autocomplete="off" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid">秒</div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">应接如户数</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="yjrhs" id="yjrhs" lay-verify="yjrhs"
                                               autocomplete="off" placeholder="请输入应接如户数"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">已接入户数</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="yijrhs" id="yijrhs" lay-verify="yijrhs"
                                               autocomplete="off" placeholder="请输入已接入户数"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="layui-row">
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">应受益人数</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="ysyrs" id="ysyrs" lay-verify="ysyrs"
                                               autocomplete="off" placeholder="请输入应受益人数"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">以收益人数</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="yjsyrs" id="yjsyrs" lay-verify="yjsyrs"
                                               autocomplete="off" placeholder="请输入以收益人数"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">带远程监控</label>
                                    <div class="layui-input-block">
                                        <select  name="dycjk" id="dycjk" lay-verify="dycjk"
                                                 class="layui-input">
                                            <option value="">请选择是否带远程监控</option>
                                            <option value="是">是</option>
                                            <option value="否">否</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设计处理量(吨/天)</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="dunwei" id="dunwei" lay-verify="dunwei"
                                               autocomplete="off" placeholder="请输入设计处理量"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="layui-row">
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设施总功率(kw)</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="zgl" id="zgl" lay-verify="zgl"
                                               autocomplete="off" placeholder="请输入设施总功率"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设计出水标准</label>
                                    <div class="layui-input-block">
                                        <select  name="csbz" id="csbz" lay-verify="csbz" class="layui-input">
                                            <option value="">请选择</option>
                                            <option value="一级">一级</option>
                                            <option value="二级">二级</option>
                                            <option value="三级">三级</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">处理工艺模式</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="clgy" id="clgy" lay-verify="clgy"
                                               autocomplete="off" placeholder="请输入处理工艺模式"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">设施状态</label>
                                    <div class="layui-input-block">
                                        <select type="text" name="sszt" id="sszt" lay-verify="sszt"
                                                class="layui-input">
                                            <option value="">请选择设施运行状态</option>
                                            <option value="正常运行">正常运行</option>
                                            <option value="调试运行">调试运行</option>
                                            <option value="在建">在建</option>
                                            <option value="调试运行">调试运行</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="layui-row">
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">污水处理设备建设单位</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="wscljsdw" id="wscljsdw" lay-verify="wscljsdw"
                                               autocomplete="off" placeholder="请输入污水处理设备建设单位"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">污水处理设备设计单位</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="wsclsjdw" id="wsclsjdw" lay-verify="wsclsjdw"
                                               autocomplete="off" placeholder="请输入污水处理设备设计单位"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">污水处理设备施工单位</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="wsclsgdw" id="wsclsgdw" lay-verify="wsclsgdw"
                                               autocomplete="off" placeholder="请输入污水处理设备施工单位"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">污水处理设备监理单位</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="wscljldw" id="wscljldw" lay-verify="wscljldw"
                                               autocomplete="off" placeholder="请输入污水处理设备监理单位"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="layui-row">
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">带在线检测</label>
                                    <div class="layui-input-block">
                                        <select  name="zxjc" id="zxjc" lay-verify="zxjc">
                                            <option value="">请选择是否在线检测</option>
                                            <option value="是">是</option>
                                            <option value="否">否</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">管网材质</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="gwcz" id="gwcz" lay-verify="gwcz"
                                               autocomplete="off" placeholder="请输入管网材质"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">主管网管径</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="zgwgj" id="zgwgj" lay-verify="zgwgj"
                                               autocomplete="off" placeholder="请输入主管网管径"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg3">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">管网长</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="gwc" id="gwc" lay-verify="gwc"
                                               autocomplete="off" placeholder="请输入管网长"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="layui-row">
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">接收日期</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="jsrqString" id="jsrqString" lay-verify="jsrqString"
                                               autocomplete="off" placeholder="请输入接收日期"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">运维日期</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="ywrqString" id="ywrqString" lay-verify="ywrqString"
                                               autocomplete="off" placeholder="请输入运维日期"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">竣工日期</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="jgrqString" id="jgrqString" lay-verify="jgrqString"
                                               autocomplete="off" placeholder="请输入竣工日期"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="layui-row">
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">运维村监督员</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="cjdy" id="cjdy" lay-verify="cjdy"
                                               autocomplete="off" placeholder="请输入运维村监督员"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">运维村监督员电话</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="cjdydh" id="cjdydh" lay-verify="cjdydh"
                                               autocomplete="off" placeholder="请输入运维村监督员电话"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">运维镇监督员</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="zjdy" id="zjdy" lay-verify="zjdy"
                                               autocomplete="off" placeholder="请输入运维镇监督员"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row">
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">运维镇监督员电话</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="zjdydh" id="zjdydh" lay-verify="zjdydh"
                                               autocomplete="off" placeholder="请输入运维镇监督员电话"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">运维区监督员</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="qjdy" id="qjdy" lay-verify="qjdy"
                                               autocomplete="off" placeholder="请输入运维区监督员"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="layui-col-lg4">
                            <div class="layui-form-item">
                                <div class="layui-col-xs12">
                                    <label class="layui-form-label">运维区监督员电话</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="qjdydh" id="qjdydh" lay-verify="qjdydh"
                                               autocomplete="off" placeholder="请输入运维区监督员电话"
                                               class="layui-input">
                                    </div>
                                </div>
                            </div>

                        </div>


                    </div>



                </div>
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-footer" style="left: 0;padding: 0px;">
                        <button class="layui-btn" lay-submit lay-filter="*" id="pushButton">确认修改</button>
                    </div>
                </div>
            </form>

        </div>
    </div>
</div>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script>
    function child(tid){
        layui.use(['form', 'laydate', 'layer'], function () {
            var $ = layui.$
                , form = layui.form
                , laydate = layui.laydate
                , layer = layui.layer;
            //路径
            var curWwwPath = window.document.location.href;
            var pathName = window.document.location.pathname;
            var pos = curWwwPath.indexOf(pathName);
            var localhostPath = curWwwPath.substring(0, pos);
            var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);

            laydate.render({
                elem: '#jsrqString' //指定元素
            });
            laydate.render({
                elem: '#ywrqString' //指定元素
            });
            laydate.render({
                elem: '#jgrqString' //指定元素
            });

            var inputCun = document.getElementById("cun");
            //获得焦点
            inputCun.onfocus=function (){
                layer.open({
                    title: "自然村选择",
                    type: 2,
                    content: localhostPath + projectName + '/rest/getRoute?type=instrument&url=treeSel',
                    //是否显示右上角关闭图标，默认为1，显示
                    area: ['90%', '91%'],
                    maxmin: true,
                    shade: 0.6,
                    anim: 4,
                    skin: 'layui-layer-molv',
                    resize: true,
                    success: function (layero, index) {  //当你需要在层创建完毕时即执行一些语句，可以通过该回调 想相当于吧值转到子界面
                        var iframe = window['layui-layer-iframe' + index];
                    }
                });
            }

            $.ajax({
                type: "get",
                url: "<%=request.getContextPath()%>/rest/base/getAllPro",
                dataType: "json",
                async: false,
                data:{
                },
                success:function (msg){
                    document.getElementById("proId").options.length = 0;
                    var content = '<option value="">请选择所属项目</option>';
                    var  xzSelect = $("#proId");
                    for (var i = 0;i<msg.data.length;i++){
                        content+='<option value="' + msg.data[i].tid + '">' + msg.data[i].name + '</option>';;
                    }
                    xzSelect.append(content)
                    form.render()
                }
            })


            $.ajax({
                type: "post",
                url: "<%=request.getContextPath()%>/rest/base/getDdLinedByTid",
                dataType: "json",
                async: false,
                data:"tid="+tid,
                success: function (msg) {
                    var jingdu = msg.jingdu
                    msg.jdu = jingdu.split("°")[0]
                    msg.jfen = jingdu.split("°")[1].split("'")[0]
                    msg.jmiao = jingdu.split("°")[1].split("'")[1].split('"')[0]
                    var weidu = msg.weidu
                    msg.wdu = weidu.split("°")[0]
                    msg.wfen = weidu.split("°")[1].split("'")[0]
                    msg.wmiao = weidu.split("°")[1].split("'")[1].split('"')[0]

                    <%--$.ajax({--%>
                    <%--    type: "get",--%>
                    <%--    url: "<%=request.getContextPath()%>/rest/base/seleAllZrc",--%>
                    <%--    dataType: "json",--%>
                    <%--    async: false,--%>
                    <%--    data:{},--%>
                    <%--    success:function (data){--%>
                    <%--        document.getElementById("cun").options.length = 0;--%>
                    <%--        var content = '<option value="">请选择自然村</option>';--%>
                    <%--        var  xzSelect = $("#cun");--%>
                    <%--        for (var i = 0;i<data.zrcList.length;i++){--%>
                    <%--            content+='<option value="' + data.zrcList[i].title + '">' + data.zrcList[i].title + '</option>';--%>
                    <%--        }--%>
                    <%--        content+='<option value="' + msg.cun + '">' + msg.cun + '</option>';--%>
                    <%--        xzSelect.append(content)--%>
                    <%--        form.render()--%>
                    <%--    }--%>
                    <%--})--%>
                    form.val("component-form-element", msg)
                }
            })


            //第一种方法添加用户
            form.on('submit(*)', function (data) {
                var field = data.field//当前容器的全部表单字段，名值对形式：{name: value}
                field.jingdu = field.jdu+'°'+field.jfen+'′'+field.jmiao+'″'
                field.weidu = field.wdu+'°'+field.wfen+'′'+field.wmiao+'″'
                var index = layer.msg('数据提交中，请稍候', {icon: 16, time: false, shade: 0.6});
                $("#pushButton").addClass("layui-btn layui-btn-disabled").prop("disabled", true);
                $.ajax({
                    type: "post",
                    url: "<%=request.getContextPath()%>/rest/base/updateDdLined",
                    data: field,
                    dataType: "json",
                    async: false,
                    success: function (obj) {
                        setTimeout(function () {
                            layer.close(index);
                            if (obj === true) {
                                layer.msg('修改成功');
                            } else {
                                layer.msg(obj.errorMsg);
                            }
                        }, 2000);
                        setTimeout(function () {
                            var indexs = parent.layer.getFrameIndex(window.name);//获取当前弹出层的层级
                            parent.layer.close(indexs);//关闭弹出层
//                        window.parent.location.reload();//刷新父页面
                        }, 4000);
                    }
                })
                return false;
            });

        });
    }

    function getCheckCun(cunname){
        document.getElementById("cun").value = cunname
    }
</script>
</body>
</html>